//
//  AvaliableCouponCell.m
//  FD
//
//  Created by xiaofang wang on 2018/11/10.
//  Copyright © 2018年 ZhiYuan Network. All rights reserved.
//  可用优惠券cell

#import "AvaliableCouponCell.h"
@interface AvaliableCouponCell()
@property (weak, nonatomic) IBOutlet UIImageView *iconIv; //图标
@property (weak, nonatomic) IBOutlet UILabel *titleLb;/**标题*/
@property (weak, nonatomic) IBOutlet UILabel *validateTimeLb; /**有效期*/
@property (weak, nonatomic) IBOutlet UILabel *expireLb; /**即将过期*/
@property (weak, nonatomic) IBOutlet UIButton *userBtn; /**使用*/
@end

@implementation AvaliableCouponCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    self.expireLb.hidden = YES; // 2019-2-26隐藏
    
    //响应者链：关闭按钮的交互，免得影响cell的点击。
    self.userBtn.userInteractionEnabled = NO;
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setModel:(AvaliableCouponModel *)model {
    _model = model;
    
    //图标
    [self.iconIv sd_setImageWithURL:[NSURL URLWithString:model.thumbnail] placeholderImage:[UIImage imageNamed:@"placeholderImage.png"]];
    //标题
    self.titleLb.text = model.title;

    //有效期限
    //时间戳转时间
    NSString *endStr = [NSString NYRtimeStrFromTimeStamp:[NSString stringWithFormat:@"%@",model.quietDate]];
    NSString *starStr = [NSString NYRtimeStrFromTimeStamp:[NSString stringWithFormat:@"%@",model.activeDate]];
    self.validateTimeLb.text = [NSString stringWithFormat:@"有效期：%@ 至 %@",starStr,endStr];
    
}

@end
